<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商品信息-修改</title>
    <meta name="description" content="这是一个商品页面">
    <meta name="keywords" content="商品">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="${contextPath}/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${contextPath}/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.datatables.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/app.css">
    <script src="${contextPath}/assets/js/jquery.min.js"></script>

</head>

<body data-type="widgets">
<script src="${contextPath}/assets/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 头部 -->
    <#include "/pc/common/header.html" />
    <!-- 侧边导航栏 -->
    <#include "/pc/common/left.html" />
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <ol class="am-breadcrumb widget-head">
                            <li><a href="${contextPath}/index.htm" class="am-icon-home">首页</a></li>
                            <li>系统管理</li>
                            <li><a href="${contextPath}/product/list.htm">商品管理</a></li>
                            <#if product?? && product.id??>
                                    <li>修改</li>
                                <#else>
                                    <li>新增</li>
                            </#if>
                        </ol>
                        <div class="widget-body  am-fr">
                            <div class="am-u-sm-12">
                                <form class="am-form am-form-horizontal" enctype="multipart/form-data"
                                      action="${contextPath}/product/save.htm" method="post" id="myform">
                                    <fieldset>
                                        <#if product?? && product.id??>
                                            <input type="hidden" name="id" value="${product.id!}">
                                        </#if>
                                        <div class="am-form-group am-g">
                                            <div class="am-u-sm-2 am-text-center">
                                                <div class="am-form-group">
                                                    <div class="am-u-sm-12">
                                                        <#if product.coverimg?? && product.coverimg!=''>
                                                            <img class="am-radius" src="${product.coverimg!''}" height="150" /><br>
                                                            <#else>
                                                                <img class="am-radius" src="${contextPath}/img/nopic.jpg" height="150" /><br>
                                                        </#if>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <div class="am-u-sm-12 am-form-file">
                                                        <button type="button" id="coverimg" style="width: 150px"
                                                                class="am-btn am-btn-danger am-btn-sm">
                                                            <i class="am-icon-cloud-upload"></i> 上传封面图片
                                                        </button>
                                                        <input id="doc-form-file" type="file" name="file">
                                                    </div>
                                                    <div id="file-list">
                                                    </div>
                                                    <script>
                                                        $(function() {
                                                            $('#doc-form-file').on('change', function() {
                                                                var fileNames = '';
                                                                $.each(this.files, function() {
                                                                    fileNames += '<span class="am-badge">' + this.name + '</span> ';
                                                                });
                                                                $('#file-list').html(fileNames);
                                                            });
                                                        });
                                                    </script>
                                                </div>
                                            </div>
                                            <div class="am-u-sm-10">
                                                <div class="am-form-group">
                                                    <label for="proname" class="am-u-sm-2 am-form-label">商品名称</label>
                                                    <div class="am-u-sm-10">
                                                        <input type="text" id="proname" name="proname"
                                                               placeholder="输入商品名称" required
                                                               value="${product.proname!''}">
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="shortname"
                                                           class="am-u-sm-2 am-form-label">商品简称</label>
                                                    <div class="am-u-sm-10">
                                                        <input type="text" id="shortname" name="shortname"
                                                               placeholder="输入商品简称" required
                                                               value="${product.shortname!''}">
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="oldprice"
                                                           class="am-u-sm-2 am-form-label">商品原价</label>
                                                    <div class="am-u-sm-10">
                                                        <input id="oldprice" type="text" name="oldprice" required onkeyup="CheckInputIntFloat(this)"
                                                               placeholder="输入商品原价" value="${product.oldprice!''}">
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="price"
                                                           class="am-u-sm-2 am-form-label">商品现价</label>
                                                    <div class="am-u-sm-10">
                                                        <input type="text" id="price" name="price" required onkeyup="CheckInputIntFloat(this)"
                                                               value="${product.price!''}" placeholder="输入商品现价">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="am-u-sm-offset-5">
                                            <button type="submit" class="am-btn am-btn-primary">
                                                保存
                                            </button>
                                            <a href="javascript:history.back();"
                                               class="am-btn am-btn-default">返回</a>
                                        </div>
                                    </fieldset>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<#include "/pc/common/alert.html" />
<script src="${contextPath}/assets/js/amazeui.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.datatables.min.js"></script>
<script src="${contextPath}/assets/js/dataTables.responsive.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.page.js"></script>
<script src="${contextPath}/assets/js/app.js"></script>
<script>
    function CheckInputIntFloat(oInput)
    {
        if('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/,''))
        {
            oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' :oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
        }
    }
</script>
</body>

</html>